#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdbool.h>
int main()
{
	int num;
	scanf("%d", &num);
	int n1 = num % 2;
	bool n2 = (num > 4 && num <= 12);
	n1 == 0 && n2 == 1 ? printf("1 ") : printf("0 ");
	n1 == 0 || n2 == 1 ? printf("1 ") : printf("0 ");
	(n1 == 0 && n2 == 0) || (n1 == 1 && n2 == 1) ? printf("1 ") : printf("0 ");
	n1 == 1 && n2 == 0 ? printf("1 ") : printf("0 ");
	return 0;
}